package com.teangtang.fly.controller;

import com.teangtang.fly.dto.OrderDTO;
import com.teangtang.fly.dto.PlaneDTO;
import com.teangtang.fly.entity.Plane;
import com.teangtang.fly.service.MyOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/order")
public class MyOrderController {
    @Autowired
    private MyOrderService myOrderService;

    @PostMapping
    public boolean createOrder(@RequestBody OrderDTO orderDTO) {
        return myOrderService.addOrder(orderDTO);
    }

    @GetMapping
    public ResponseEntity<List<OrderDTO>> getAllOrders() {
        return ResponseEntity.ok(myOrderService.getAllOrders());
    }

}
